package com.mynews.mvp.presenter;

import com.mynews.bean.ZhihuDetailBean;
import com.mynews.common.CommonNetSubscriber;
import com.mynews.mvp.model.DailyDetailModel;
import com.mynews.mvp.view.DailyDetailViewInterface;

/**
 * Created by Administrator on 2017/6/23.
 */

public class DailyDetailPresenter {
    private static final String TAG = DailyDetailPresenter.class.getSimpleName();
    private DailyDetailViewInterface viewInterface;
    private DailyDetailModel model;

    public DailyDetailPresenter(DailyDetailViewInterface viewInterface){
        this.viewInterface = viewInterface;
        model = new DailyDetailModel();
    }

    public void doLoadData(String id){
        model.doLoadDataDetail(id).subscribe(new CommonNetSubscriber<ZhihuDetailBean>(){
            @Override
            public void onError(Throwable e) {
                super.onError(e);
                viewInterface.dailyErorr();
            }

            @Override
            public void onNext(ZhihuDetailBean zhihuDetailBean) {
                super.onNext(zhihuDetailBean);
                viewInterface.dailyDetailShowContent(zhihuDetailBean);

            }
        });
    }


}
